/*
 * @Date: 2023-01-22 03:27:26
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-22 09:05:54
 * @FilePath: \campus-repair-platform\server\schema\manage\repair.js
 */

/**
 * query_schema 查询报修单
 * state_schema     修改报修单状态
 * examine_schema   审核报修单
 */

const joi = require("joi")

const { id } = require("../common")

exports.query_schema = {
  query: {
    id: id
      .error(new Error("id格式有误")),
    state: joi.number().min(-3).max(8).error(new Error("状态格式有误")),
  },
}

exports.state_schema = {
  body: {
    id: id.required(),
    state: joi.number().min(1).max(8).required().error(new Error("状态格式有误")),
    newState: joi.number().min(1).max(6).required().error(new Error("新状态格式有误")),
  }
}

exports.examine_schema = {
  body: {
    id: id.required(),
    is_adopt: joi.boolean().required().error(new Error("是否通过格式有误")),
    cause: joi.string().min(1).max(200).error(new Error("退回原因格式有误"))
  }
}
